package com.zero.qth.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zero.common.core.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.zero.qth.mapper.PropertyMapper;
import com.zero.qth.domain.Property;
import com.zero.qth.service.IPropertyService;

/**
 * 配置表Service业务层处理
 * 
 * @author cai-xu-kun
 * @date 2025-09-26
 */
@Service
@RequiredArgsConstructor
public class PropertyServiceImpl extends ServiceImpl<PropertyMapper, Property> implements IPropertyService {

    private final PropertyMapper propertyMapper;

    /**
     * 查询配置表分页
     *
     * @param property 配置表
     * @param p 分页数据
     * @return 配置表
     */
    @Override
    public Page<Property> selectPropertyListPage(Property property, Page<Property> p) {
        return propertyMapper.selectPropertyListPage(property, p);
    }

    /**
     * 查询配置表
     * 
     * @param theKey 配置表主键
     * @return 配置表
     */
    @Override
    public Property selectPropertyByTheKey(String theKey) {
        return propertyMapper.selectPropertyByTheKey(theKey);
    }

    /**
     * 查询配置表列表
     * 
     * @param property 配置表
     * @return 配置表
     */
    @Override
    public List<Property> selectPropertyList(Property property) {
        return propertyMapper.selectPropertyList(property);
    }

    /**
     * 新增配置表
     * 
     * @param property 配置表
     * @return 结果
     */
    @Override
    public int insertProperty(Property property) {
        property.setCreateTime(DateUtils.getNowDate());
        return propertyMapper.insertProperty(property);
    }

    /**
     * 修改配置表
     * 
     * @param property 配置表
     * @return 结果
     */
    @Override
    public int updateProperty(Property property) {
        property.setUpdateTime(DateUtils.getNowDate());
        return propertyMapper.updateProperty(property);
    }

    /**
     * 批量删除配置表
     * 
     * @param theKeys 需要删除的配置表主键
     * @return 结果
     */
    @Override
    public int deletePropertyByTheKeys(String[] theKeys) {
        return propertyMapper.deletePropertyByTheKeys(theKeys);
    }

    /**
     * 删除配置表信息
     * 
     * @param theKey 配置表主键
     * @return 结果
     */
    @Override
    public int deletePropertyByTheKey(String theKey) {
        return propertyMapper.deletePropertyByTheKey(theKey);
    }
}
